<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script>
    var counter = 1;
    var t = async_test("Verify that write width hint is sent when picture is involved.");
    window.addEventListener("message", t.step_func(function (message) {
        if (message.data.indexOf("fail") != -1) {
            assert_unreached("The test failed on " + message.data);
            t.done();
            return;
        }
        if (counter == 1) {
            assert_equals(message.data, "resize");
            ++counter;
            if (child.testRunner) {
              // resizeTo() doesn't seem to trigger selection of different
              // <source> otherwise.
              child.testRunner.useUnfortunateSynchronousResizeMode();
            }
            child.resizeTo(600, 600);
        } else {
            assert_equals(message.data, "success");
            t.done();
        }
    }));

    var child = window.open("resources/window-ch-with-picture.php", "_blank",
                            "innerWidth=800, innerHeight=600");
</script>
